package com.nercel.dsj.gksales.model.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author sunlin
 * @date 2019-3-14
 */
@Data
public class UserInfoResultDTO {

	@ApiModelProperty(value = "ID")
	private Integer id;

	@ApiModelProperty(value = "用户名")
	private String username;

	@ApiModelProperty(value = "密码")
	@JsonIgnore
	private String password;

	@ApiModelProperty(hidden = true)
	@JsonIgnore
	private String salt;

	@ApiModelProperty(value = "名称")
	private String nickname;

	@ApiModelProperty(value = "手机号")
	private String phone;

	@ApiModelProperty(value = "角色")
	private List<String> roles = new ArrayList<>();

	@ApiModelProperty(value = "高考省份")
	private Integer gaokaoRegionId;

	@ApiModelProperty(value = "手机省份")
	private Integer phoneRegionId;

	@ApiModelProperty(value = "创建时间")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;

	@ApiModelProperty(value = "注册IP")
	private String registerIp;

	@ApiModelProperty(value = "最后登录IP")
	private String lastLoginIp;

	@ApiModelProperty(value = "最后登录时间")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date lastLoginTime;

	@ApiModelProperty(value = "VIP到期时间")
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date vipTime;

	@ApiModelProperty(value = "VIP类型 0非VIP 1全权限VIP  2体验VIP")
	private Integer vipType;

	@ApiModelProperty(value = "功能1体验次数")
	private Integer f1Times;

	@ApiModelProperty(value = "功能1体验次数")
	private Integer f2Times;

	@ApiModelProperty(value = "功能1体验次数")
	private Integer f3Times;

	@ApiModelProperty(value = "试用用户")
	private Boolean trial;

	@ApiModelProperty(value = "已完成分数更新")
	private Boolean filled;

	@ApiModelProperty(value = "性别")
	private Integer sex;

	@ApiModelProperty(value = "高中学校")
	private String school;

	@ApiModelProperty(value = "高中年级")
	private String grade;

	@ApiModelProperty(value = "文理科")
	private String subjectType;

	@ApiModelProperty(value = "分数")
	private Integer score;

	@ApiModelProperty(value = "排名")
	private Integer rank;

	@ApiModelProperty(value = "备注")
	private String remark;

	@ApiModelProperty(value = "完备高考信息")
	private boolean isFullGaokaoInfo;

	@ApiModelProperty(value = "是否VIP")
	private boolean isVip;

	@ApiModelProperty(value = "是否VIP渠道用户")
	private boolean isVipChannel = false;

	@ApiModelProperty(value = "临时VIP")
	private boolean isTempVip = false;

	@ApiModelProperty(value = "HLD测试结果")
	private String hldResult;

	@ApiModelProperty(value = "MBTI测试结果")
	private String mbtiResult;

	public String getNickname(){
		return nickname == null || "".equals(nickname.trim())
				? phone : nickname;
	}

}
